﻿Public Class EmkVergiDosya
    'Inherits Process

    '' Dim Row As String = "¶~~~~~¶~•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••[TARIH]¶~••[ADSOYAD]¶~••[ADRES]¶~¶~¶~¶~¶~¶~¶~¶~¶~¶~••••••••[DOSYANO]••••••••••••••••••••••••••••••••••••••••••••••••••••[KIMLIK]¶~¶~••••••••[ADSOYAD]¶~¶~••••••••[CINS]¶~¶~••••••••••••[DOGUMTAR]¶€"
    'Dim Row As String = "¶~~~~~¶~•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••[TARIH]¶~••[ADSOYAD]¶~••[ADRES]¶~¶~¶~¶~¶~¶~¶~¶~¶~¶~••••••••[DOSYANO]••••••••••••••••••••••••••••••••••••••••••••••••••••[KIMLIK]¶~¶~••••••••[ADSOYAD]¶~¶~••••••••[CINS]¶~¶~••••••••••••[DOGUMTAR]¶¶[SAYAC]¶€"

    'Public Overrides Sub GenericEvent(ByVal e As ProcessEventArgs)
    '    Select Case e.EventType
    '        Case EventType.Initialize
	'            Text ="Vergi Baskı Dosyası"
    '            DisplayForm()
    '            Dim Text As String = "" ' "~"
    '            Dim i, k, FileCounter As Int16
    '            Dim sayac As Int16 = 1
    '            Q("select adi,soyadi,hturu,kararno,kimlik,cins,dtar,adr,adrsemt,adrsehir from yaslılık..yasmaasbil where kimlik in (")
    '            Q("select kimlik from yaslılık..yasmaas where yil = 2010 and ay = 8 and odeyerkod not in (285,286,287) and not kimlik in (select kimlik from yaslılık..maliyeemk) group by kimlik having sum(maas) <= 2560)")
    '            Q("and kimlik not in (select kimlik from shesk where bordrotar = '20100601')")
    '            Q("order by kimlik")
    '            Rs = OpenSQL("*")

    '            Do Until Rs.EOF

    '                For k = 0 To 249
    '                    Dim Line As String = "" '= Row
    '                    'Line = Line.Replace("[TARIH]", "06/09/2010")
    '                    'Line = Line.Replace("[ADSOYAD]", Trim(Rs("adi")) & " " & Trim(Rs("soyadi")))
    '                    'Line = Line.Replace("[ADRES]", Trim(IsNull(Rs("adr"), "")) & " " & Trim(IsNull(Rs("adrsemt"), "")) & " " & Trim(IsNull(Rs("adrsehir"), "")))
    '                    'Line = Line.Replace("[DOSYANO]", Rs("hturu") & "-" & Rs("kararno"))
    '                    'Line = Line.Replace("[KIMLIK]", Rs("kimlik"))
    '                    'Line = Line.Replace("[CINS]", Rs("cins"))
    '                    'Line = Line.Replace("[DOGUMTAR]", DMY(Rs("dtar")))
    '                    'Line = Line.Replace("[SAYAC]", "[" & sayac & "]")
    '                    'Text &= Line
    '                    Line += "-" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10)
    '                    Line += "                                                                                                                                                                                                     16/09/2010" & Chr(13) & Chr(10)
    '                    Line += Trim(Rs("adi")) & " " & Trim(Rs("soyadi")) & Chr(13) & Chr(10)
    '                    Line += Trim(IsNull(Rs("adr"), "")) & " " & Trim(IsNull(Rs("adrsemt"), "")) & " " & Trim(IsNull(Rs("adrsehir"), "")) & Chr(13) & Chr(10)
    '                    Line += Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10)
    '                    Line += "          " & Trim(Rs("kimlik")) & "                                                 " & Rs("hturu") & "-" & Rs("kararno") & Chr(13) & Chr(10) & Chr(13) & Chr(10)
    '                    Line += "          " & Trim(Rs("adi")) & " " & Trim(Rs("soyadi")) & Chr(13) & Chr(10) & Chr(13) & Chr(10)
    '                    Line += "          " & Rs("cins") & Chr(13) & Chr(10) & Chr(13) & Chr(10)
    '                    Line += "          " & DMY(Rs("dtar")) & Chr(13) & Chr(10) & Chr(13) & Chr(10)
    '                    For i = 1 To 39
    '                        Line += Chr(13) & Chr(10)
    '                    Next
    '                    Line += sayac & Chr(13) & Chr(10)

    '                    'Line = Line.Replace(Chr(222), Chr(35))
    '                    'Line = Line.Replace(Chr(254), Chr(36))
    '                    'Line = Line.Replace(Chr(199), Chr(60))
    '                    'Line = Line.Replace(Chr(231), Chr(62))
    '                    'Line = Line.Replace(Chr(208), Chr(64))
    '                    'Line = Line.Replace(Chr(240), Chr(96))
    '                    'Line = Line.Replace(Chr(221), Chr(94))
    '                    'Line = Line.Replace(Chr(253), Chr(126))
    '                    'Line = Line.Replace(Chr(214), Chr(92))
    '                    'Line = Line.Replace(Chr(246), Chr(124))
    '                    'Line = Line.Replace(Chr(220), Chr(93))
    '                    'Line = Line.Replace(Chr(252), Chr(125))

    '                    'Line = Line.Replace("[SAYAC]", "[" & sayac & "]")
    '                    Text &= Line
    '                    sayac += 1
    '                    Rs.MoveNext()

    '                    If Rs.EOF Then Exit For

    '                Next k

    '                FileCounter += 1
    '                FileSystem.SaveContentsToFile(Text, My.Computer.FileSystem.SpecialDirectories.Desktop & "\Vergi\vergi_" & FileCounter & ".txt")
    '                Text = ""
    '                '    Info("Dosya oluşturuldu.")


    '            Loop
    '            'Text = Text.Replace("¶", Chr(13))
    '            'Text = Text.Replace("~", Chr(10))
    '            'Text = Text.Replace("€", Chr(12))
    '            'Text = Text.Replace("•", " ")
    '            'FileSystem.SaveContentsToFile(Text, My.Computer.FileSystem.SpecialDirectories.Desktop & "\vergi.txt")
    '            Info("Dosya oluşturuldu.")
    '    End Select
    'End Sub

    ''    Function trcodepage(ByVal s As String) As String
    ''Dim  i integer

    ''  for i := 1 to length(s) do
    ''            begin()
    ''      case ord(s[i]) of
    ''        222: s[i] := CHR(35);
    ''        254: s[i] := CHR(36);
    ''        199: s[i] := CHR(60);
    ''        231: s[i] := CHR(62);
    ''        208: s[i] := CHR(64);
    ''        240: s[i] := CHR(96);
    ''        221: s[i] := CHR(94);
    ''        253: s[i] := CHR(126);
    ''        214: s[i] := CHR(92);
    ''        246: s[i] := CHR(124);
    ''        220: s[i] := CHR(93);
    ''        252: s[i] := CHR(125);

    ''      end;
    ''    end;
    ''  result := s;
    ''end;

    ''function Tfrmana.trcodepage2(s: string): string;
    ''var i: integer;
    ''        begin()
    ''  for i := 1 to length(s) do
    ''            begin()
    ''      case ord(s[i]) of
    ''        222: s[i] := CHR(158);    //Ş  +
    ''        254: s[i] := CHR(159);    //ş  +
    ''        199: s[i] := CHR(128);     //Ç +
    ''        231: s[i] := CHR(135);     //ç +
    ''        208: s[i] := CHR(166);     //Ğ +
    ''        240: s[i] := CHR(167);     //ğ +
    ''        221: s[i] := CHR(152);     //İ +
    ''        253: s[i] := CHR(141);    //ı  +
    ''        214: s[i] := CHR(153);     //Ö
    ''        246: s[i] := CHR(148);    //ö
    ''        220: s[i] := CHR(154);     //Ü
    ''        252: s[i] := CHR(129);    //ü

    ''      end;
    ''    end;
    ''  result := s;
    ''end;
End Class
